import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'
import dts, {PluginOptions as DtsOptions} from 'vite-plugin-dts'

const dtsOptions:DtsOptions = {
  tsconfigPath:'tsconfig.build.json',
  outDir: 'dist/types'
}

export default defineConfig({
  plugins: [vue(), dts(dtsOptions)],
  build: {
    lib: {
      formats: ['es'],
      entry: path.resolve(__dirname, 'src/index.ts'),
      fileName: (format) => `au-color-picker.${format}.js`,
    },
    rollupOptions: {
      external: ['vue', 'color-convert']
    },
    outDir:'./dist',
    emptyOutDir:true,
    copyPublicDir:false
  },
  css:{
    preprocessorOptions:{
      scss:{
        api: 'modern-compiler'
      }
    }
  }
})
